﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 状态模式_应用实例
{
    abstract class State
    {
        public abstract bool Working(int Hour);
    }

    class ForenoonState : State
    {
        public override bool Working(int Hour)
        {
            if (Hour >= 8 && Hour <= 11)
            {
                Console.WriteLine("早上阳光明媚");
                return true;
            }
            return false;
        }
    }

    class NoonState : State
    {
        public override bool Working(int Hour)
        {
            if (Hour >= 12 && Hour <= 13)
            {
                Console.WriteLine("中午昏昏欲睡");
                return true;
            }
            return false;
        }
    }

    class AfternoonState : State
    { 
        public override bool Working(int Hour)
        {
            if (Hour >= 14 && Hour <= 18)
            {
                Console.WriteLine("下午无限期待（下班）");
                return true;
            }
            return false;
        }   
    }

    class EveningState : State
    { 
        public override bool Working(int Hour)
        {
            if (Hour > 22)
            {
                Console.WriteLine("周公赴会");
                return true;
            }
            return false;
        }   
    }
}
